package com.ssuu.ssuusnow.project.manage.menu_role.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ssuu.ssuusnow.project.manage.menu_role.entity.MenuRole;
import com.ssuu.ssuusnow.project.manage.menu_role.mapper.MenuRoleMapper;
import com.ssuu.ssuusnow.project.manage.menu_role.service.IMenuRoleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ssuu.ssuusnow.project.manage.user.entity.User;
import com.ssuu.ssuusnow.project.manage.user_role.entity.UserRole;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 角色  菜单 服务实现类
 * </p>
 *
 * @author sun
 * @since 2023-06-14
 */
@Service
public class MenuRoleServiceImpl extends ServiceImpl<MenuRoleMapper, MenuRole> implements IMenuRoleService {

    @Resource
    MenuRoleMapper menuRoleMapper;
    @Override
    public List<MenuRole> getlist(List<UserRole> list) {
        QueryWrapper<MenuRole> wrappers = new QueryWrapper<>();
        List<Long> listStr = new ArrayList<>();
        list.forEach(x->listStr.add(x.getRoleID()));
        wrappers.in("roleID",listStr);
        wrappers.select("DISTINCT menuID");
        return menuRoleMapper.selectList(wrappers);
    }
}
